home *** CD-ROM | disk | FTP | other *** search
/ Compendium Deluxe 2 / LSD and 17bit Compendium Deluxe - Volume II.iso / a / prog / asmsrc / c64menu.lha / menu.s3 < prev    next >
Encoding:
Text File  |  1989-06-22  |  19.4 KB  |  1,174 lines

  1.     section andy,code_c
  2.     opt c-,d+
  3.  
  4.     *************************
  5.     * Setup V2.1 Rev.3/3/90 *
  6.     *************************
  7.  
  8. startlist1    equ    38
  9. startlist2    equ    50
  10.  
  11. plnw        equ    40
  12. plnh        equ    266
  13. plnsize        equ    plnw*plnh
  14. plnnum        equ    2
  15. plndata        equ    plnsize*plnnum
  16.  
  17.     move.l    4,a6
  18.     move.l    #$10002,d1
  19.     move.l    #plndata,d0
  20.     jsr    -198(a6)
  21.     cmp.l    #$00,d0
  22.     beq    error
  23.     move.l    d0,plnbase
  24.  
  25.     move.l    4,a6
  26.     move.l    #gfxname,a1
  27.     moveq.l    #0,d0
  28.     jsr    -552(a6)
  29.     move.l    d0,gfxbase
  30.  
  31.     move.l    gfxbase,a4
  32.  
  33.  
  34.     move.l    4,a6
  35.     move.l    #dosname,a1
  36.     moveq.l    #0,d0
  37.     jsr    -552(a6)
  38.     move.l    d0,dosbase
  39.  
  40.     MOVE.W    #$0080,$dff096
  41.     move.w    $dff01c,sysint
  42.     or.w    #$c000,sysint
  43.     ;move.w    #$7fff,$dff09a
  44.     ;move.w    #$c020,$dff09a
  45.     move.l    $6c,intsave
  46.     move.l    #newcopper,$dff080
  47.     clr.w    $dff088
  48.     move.w    #$8480,$dff096    
  49.     move.l    plnbase,a1
  50.     move.l    #plnsize,d0
  51.     move.l    a1,stor
  52.     move.l    stor,pln1
  53.     move.w    stor,bp2+2
  54.     move.w    stor+2,bp2+6
  55.  
  56.     add.l    d0,stor
  57.     move.l    stor,pln2
  58.     move.w    stor,bp1+2
  59.     move.w    stor+2,bp1+6
  60.  
  61.     add.l    #40*24,pln1    
  62.  
  63.     move.l    #2559,d0
  64.     lea    screen,a0
  65.     move.l    pln2,a1
  66. loop:    move.l    (a0)+,(a1)+
  67.     dbra    d0,loop
  68.  
  69.     move.b    #0,xpos
  70.     move.b    #0,ypos
  71.  
  72.     move.w    #0,bordcol+2
  73.     move.w    #0,backcol+2
  74.     move.w    #$0fff,pencol+2
  75.  
  76.     lea    starttxt,a0
  77.     jsr    print
  78. wait2:    btst    #6,$bfe001        ;wait for mouse.
  79.     bne    wait2
  80.  
  81.  
  82. wait3:    btst    #6,$bfe001        ;wait for mouse.
  83.     beq    wait3
  84.  
  85.     move.w    #$089f,bordcol+2
  86.     move.w    #$015b,backcol+2
  87.     move.w    #$089f,pencol+2
  88.  
  89.     jsr    cls
  90.  
  91.     lea    txt1,a0
  92.     jsr    print
  93.  
  94.     ;lea    getdirtxt,a0
  95.     ;jsr    print
  96.  
  97.     ;move.l    #1,getdir
  98.     
  99.     jsr    killspr
  100.  
  101.     ;move.l    #isr,$6c
  102.  
  103. wait:    jsr    task            ;jmp to our sub.
  104.     btst    #6,$bfe001        ;wait for mouse.
  105.     bne    wait
  106.     move.l    gfxbase,a4
  107.     move.l    startlist1(a4),$dff080
  108.     move.l    startlist2(a4),$dff084
  109.     clr.w    $dff088    
  110.     ;move.l    intsave,$6c
  111.     ;move.w    sysint,$dff09a
  112.     move.w    #$8080,$dff096
  113.     move.w    #$0400,$dff096
  114.     move.l    4,a6
  115.     move.l    plnbase,a1
  116.     move.l    #plndata,d0
  117.     jsr    -210(a6)
  118.     move.l    gfxbase,a1
  119.     jsr    -414(a6)
  120.  
  121. error:    move.w    #$0fff,$dff180
  122.     rts                ;exit.
  123.  
  124. newcopper:                    
  125.     dc.w    $0100,$2200
  126. scrl:    dc.w    $0102,$0000
  127.  
  128. bp1:    dc.w    $00e0,$0000,$00e2,$0000
  129. bp2:    dc.w    $00e4,$0000,$00e6,$0000
  130. bp3:    dc.w    $00e8,$0000,$00ea,$0000
  131. bp4:    dc.w    $00ec,$0000,$00ee,$0000
  132. bp5:    dc.w    $00f0,$0000,$00f2,$0000
  133.  
  134.     dc.w    $008E,$2c81,$0090,$2cc1                                 
  135.     dc.w    $0092,$0038,$0094,$00d0
  136. mod:    dc.w    $0108,$0000,$010a,$0000
  137.  
  138. sp0:    dc.w    $0120,$0000,$0122,$0000    
  139. sp1:    dc.w    $0124,$0000,$0126,$0000    
  140. sp2:    dc.w    $0128,$0000,$012a,$0000    
  141. sp3:    dc.w    $012c,$0000,$012e,$0000    
  142. sp4:    dc.w    $0130,$0000,$0132,$0000    
  143. sp5:    dc.w    $0134,$0000,$0136,$0000    
  144. sp6:    dc.w    $0138,$0000,$013a,$0000    
  145. sp7:    dc.w    $013c,$0000,$013e,$0000    
  146.  
  147. bordcol:dc.w    $0180,$089f
  148. backcol:dc.w    $0182,$015b
  149. pencol:    dc.w    $0186,$089f
  150.  
  151.     dc.w    $ffff,$fffe
  152.  
  153.     dc.b    '********  Write to me (Mindeater) ********'
  154.     dc.b    'A.Clark    2 Highfield Rise    Eastend Road    Hull    HU12 8RA    '
  155.     dc.b    '********      Thanks!!!     ********'
  156.  
  157.     
  158. gfxname:dc.b    'graphics.library',0
  159.     even
  160. gfxbase:dc.l    0
  161.  
  162. dosname:dc.b    'dos.library',0
  163.     even
  164. dosbase:dc.l    0
  165.  
  166. stor:    dc.l    0
  167. pln1:    dc.l    0
  168. pln2:    dc.l    0
  169. pln3:    dc.l    0
  170. pln4:    dc.l    0
  171. pln5:    dc.l    0
  172. sysint:    dc.w    0
  173. intsave:dc.l    0
  174. int2save:dc.l    0
  175. plnbase:dc.l    0
  176. copsave1:dc.l    0
  177. copsave2:dc.l    0
  178.  
  179. xpos:    dc.b    0
  180. ypos:    dc.b    0
  181. cstate:    dc.w    0    ;1 on
  182. ccount:    dc.w    0
  183. crate:    dc.w    6800
  184. inverse:dc.l    0
  185. getdir:    dc.l    0
  186. shft:    dc.l    0
  187. stringoff:
  188.     dc.l    0
  189. loaded:    dc.l    0
  190. zero:    dc.l    0
  191.  
  192. isr:    movem.l    d0-d7/a0-a6,-(sp)
  193.     move.w    #$0020,$dff09c
  194.     movem.l    (sp)+,d0-d7/a0-a6
  195.     rte
  196.  
  197. task:    ;move.w    $dff006,d0
  198.     ;and.w    #$ff00,d0
  199.     ;cmp.w    #$ff00,d0
  200.     ;bne    task
  201.     tst.l    getdir
  202.     beq    .lp
  203.  
  204.     jsr    loaddir
  205. .lp:    jsr    docurs
  206.  
  207.     jsr    getkey
  208.     tst.l    keyread
  209.     beq    .lp2
  210.     jsr    dokeys
  211. .lp2:    rts
  212.  
  213.  
  214.     *****************************
  215.     *Note:-                   *
  216.     * A-Obj                   *
  217.     * B-Msk                     *
  218.     * C-Bck                     *
  219.     * D-Bck                     *
  220.     * M-00001111 10111000       *
  221.     *****************************
  222.  
  223.  
  224.  
  225.     ******************************
  226.     *Char string print grey chars
  227.     *chars 1 bp,528 pix w,66 chars 
  228.     *screen width equ #40b
  229.     *a0 text string x,y
  230.     *pln num in a6
  231.     *255 cr,0 termination
  232.     *d7,d6
  233.     *a0,a5,a6
  234.     ******************************
  235. Print:    
  236.     move.b    xpos,(a0)
  237.     move.b    ypos,1(a0)
  238.     move.l    #0,inverse
  239.     move.l    pln1,a6
  240.     moveq.l    #0,d7
  241.     moveq.l    #0,d6
  242.     move.b    (a0)+,d7    ;get x
  243.     add.l    d7,a6
  244.     move.b    (a0)+,d7    ;get y
  245.     mulu.w    #40*8,d7
  246.     add.l    d7,a6        ;a6 strt addr
  247.  
  248. prchr2:    moveq.l    #0,d7
  249.     lea    chars,a5
  250. invbac:    move.b    (a0)+,d7    ;get char
  251.     beq    prend2
  252.     cmp.b    #255,d7
  253.     beq    print
  254.     cmp.b    #13,d7
  255.     beq    ret
  256.     cmp.b    #128,d7
  257.     bne    noinv
  258.     move.l    #1,inverse
  259.     bra    invbac
  260. noinv:    sub.b    #32,d7
  261.     btst.l    #6,d7
  262.     beq    notlo2
  263.     sub.b    #32,d7
  264. notlo2:    add.l    d7,a5
  265.     
  266.     move.b    (a5),(a6)
  267.     move.b    64(a5),40(a6)
  268.     move.b    128(a5),80(a6)
  269.     move.b    192(a5),120(a6)
  270.     move.b    256(a5),160(a6)
  271.     move.b    320(a5),200(a6)
  272.     move.b    384(a5),240(a6)
  273.     move.b    448(a5),280(a6)
  274.     tst.l    inverse
  275.     beq    noinv2
  276.     eor.b    #-1,(a6)
  277.     eor.b    #-1,40(a6)
  278.     eor.b    #-1,80(a6)
  279.     eor.b    #-1,120(a6)
  280.     eor.b    #-1,160(a6)
  281.     eor.b    #-1,200(a6)
  282.     eor.b    #-1,240(a6)
  283.     eor.b    #-1,280(a6)
  284. noinv2:    add.l    #1,a6
  285.     bra    prchr2
  286. prend2:    rts    
  287. ret:    cmp.b    #24,ypos
  288.     beq    ret2
  289.     add.b    #1,ypos
  290.     bra    invbac
  291. ret2:    
  292.     move.l    pln1,d0
  293.     move.l    d0,d1
  294.     add.l    #8*40,d1
  295.     move.l    d1,$dff050    ;a source IM
  296.     move.l    d0,$dff054    ;d source
  297.     move.w    #$0000,$dff064    ;a mod
  298.     move.w    #$0000,$dff066    ;d mod
  299.     move.w    #$ffff,$dff044    ;fw mask
  300.     move.w    #$ffff,$dff046    ;lw mask
  301.     move.w    #%0000100111110000,$dff040    ;con0
  302.     move.w    #%0000000000000000,$dff042    ;con1
  303.     move.w    #%0011001000010100,$dff058    ;size        
  304. .lp:    btst    #14,$dff002
  305.     bne    .lp
  306.  
  307.     bra    invbac
  308.  
  309. chars:    incbin    'charsiff'
  310.     even
  311.  
  312.     **************************
  313.     *Read keyboard & auto repeat
  314.     *key in keyread.b
  315.     *d0
  316.     **************************
  317.  
  318. Getkey:    
  319.     move.b    $bfec01,keyread
  320.     beq    .lq
  321.     move.b    #0,$bfec01
  322. .lq:    rts
  323.     cmp.b    #0,keyrep
  324.     beq    tstkey
  325.     move.b    keypress,d0
  326.     cmp.b    $bfec01,d0
  327.     beq    subrep
  328. newkey:    move.b    $bfec01,keypress
  329.     move.b    $bfec01,keyread
  330.     move.b    #4,keyrep
  331.     rts
  332. subrep:    sub.b    #1,keyrep
  333.     move.b    #0,keyread
  334.     rts
  335. tstkey:    move.b    keypress,d0
  336.     cmp.b    $bfec01,d0
  337.     bne    newkey
  338.     move.b    $bfec01,keyread
  339.     rts    
  340. nokeys:
  341.     move.b    #0,keyread
  342.     rts
  343.  
  344. keyread:
  345.     dc.l    0
  346. slow:    dc.l    0
  347. keyrep:    dc.l    0
  348. keypress:
  349.     dc.l    0
  350.     even
  351. txtdig:    
  352.     dc.b    $eb,$fd,$fb,$f9,$f7,$f5        ;nums
  353.     dc.b    $f3,$f1,$ef,$ed
  354.  
  355.     dc.b    $e1,$c5,$c3,$c1,$a5,$a3,$a1,$85,$83,$81        ;keypad
  356.  
  357.     dc.b    $bf,$95,$99,$bb,$db,$b9            ;a-z
  358.     dc.b    $b7,$b5
  359.     dc.b    $d1,$b3,$b1,$af,$91,$93,$cf,$cd
  360.     dc.b    $df,$d9,$bd,$d7,$d3,$97,$dd,$9b
  361.     dc.b    $d5,$9d
  362.  
  363.     dc.b    $7f,$8f,$8d,$8b,$ad,0
  364.  
  365. shtxtdig:
  366.     dc.b    $fd,$fb,$f9,$f7,$f5        ;nums
  367.     dc.b    $f3,$f1,$ef,$ed,$eb
  368.  
  369.     dc.b    $ad,$8b,0
  370.  
  371. txtnum:    dc.b    '0123456789'
  372.     dc.b    '0123456789'    ;keypad
  373.     dc.b    'ABCDEFGHIJKLMNOPQRSTUVWXYZ ,./;'''
  374.  
  375. shtxtnum:
  376.     dc.b    '!"#$%^&*():?'
  377.  
  378. hexdig:    dc.b    '0123456789abcdef'
  379.  
  380. string:    dc.b    0,0,' ',0
  381. comline:ds.b    41
  382.     even
  383.  
  384. dokeys:    ;move.b    xpos,-(sp)
  385.     ;move.b    ypos,-(sp)
  386.     ;move.b    #0,xpos
  387.     ;move.b    #0,ypos
  388.     ;lea    hexdig,a0
  389.     ;moveq.l    #0,d0
  390.     ;move.b    keyread,d0
  391.     ;and.b    #$0f,d0
  392.     ;move.b    (a0,d0),shkeytxt+3
  393.     ;move.b    keyread,d0
  394.     ;and.b    #$f0,d0
  395.     ;lsr.b    #4,d0
  396.     ;move.b    (a0,d0),shkeytxt+2
  397.     ;lea    shkeytxt,a0
  398.     ;jsr    print
  399.     ;move.b    (sp)+,ypos
  400.     ;move.b    (sp)+,xpos
  401.  
  402.     move.b    keyread,d0
  403.     cmp.b    #$3f,d0
  404.     beq    shfton
  405.     cmp.b    #$3d,d0
  406.     beq    shfton
  407.  
  408.     cmp.b    #$7d,d0
  409.     beq    delch
  410.  
  411.     cmp.b    #$77,d0
  412.     beq    retch
  413.  
  414.     cmp.b    #$3e,d0
  415.     beq    shftoff
  416.     cmp.b    #$3c,d0
  417.     beq    shftoff
  418.  
  419.     tst.l    shft
  420.     bne    keyshft
  421.  
  422.  
  423.     move.l    stringoff,d2
  424.     cmp.l    #39,d2
  425.     bne    .lp2
  426.     rts
  427.  
  428. .lp2:    moveq.l    #0,d1
  429.     lea    txtnum,a0
  430.     lea    txtdig,a1
  431. .lp:    cmp.b    (a1,d1),d0
  432.     beq    .gotch
  433.     add.b    #1,d1
  434.     tst.b    (a1,d1)
  435.     bne    .lp
  436.     rts
  437. .gotch:    lea    comline,a1
  438.     move.l    stringoff,d0
  439.     move.b    (a0,d1),(a1,d0)
  440.     move.b    (a0,d1),string+2
  441.     lea    string,a0
  442.     jsr    print
  443.     add.l    #1,stringoff
  444.     add.b    #1,xpos
  445.     move.b    #0,ccount
  446.     move.b    #0,cstate
  447.     rts
  448.  
  449. keyshft:move.l    stringoff,d2
  450.     cmp.l    #39,d2
  451.     bne    .lp2
  452.     rts
  453.  
  454. .lp2:    moveq.l    #0,d1
  455.     lea    shtxtnum,a0
  456.     lea    shtxtdig,a1
  457. .lp:    cmp.b    (a1,d1),d0
  458.     beq    .gotch
  459.     add.b    #1,d1
  460.     tst.b    (a1,d1)
  461.     bne    .lp
  462.     rts
  463. .gotch:    lea    comline,a1
  464.     move.l    stringoff,d0
  465.     move.b    (a0,d1),(a1,d0)
  466.     move.b    (a0,d1),string+2
  467.     lea    string,a0
  468.     jsr    print
  469.     add.l    #1,stringoff
  470.     add.b    #1,xpos
  471.     move.b    #0,ccount
  472.     move.b    #0,cstate
  473.     rts
  474.  
  475. shfton:    move.l    #1,shft
  476.     ;move.w    #$0fff,col+2
  477.     rts
  478. shftoff:move.l    #0,shft
  479.     ;move.w    #$089f,col+2
  480.     rts
  481. delch:    tst.l    stringoff
  482.     beq    .lp
  483.     sub.l    #1,stringoff
  484.     lea    comline,a0
  485.     move.l    stringoff,d0
  486.     move.b    #0,(a0,d0)
  487.     move.b    #32,string+2
  488.     lea    string,a0
  489.     jsr    print
  490.     sub.b    #1,xpos
  491.     lea    string,a0
  492.     jsr    print
  493.     move.b    #0,ccount
  494.     move.b    #0,cstate
  495. .lp:    rts
  496.  
  497. shkeytxt:
  498.     dc.b    0,0,'00',0
  499.     
  500.     even
  501.     
  502. killspr:
  503.     move.l    #blnkspr,d0
  504.     move.w    d0,sp0+6
  505.     move.w    d0,sp1+6
  506.     move.w    d0,sp2+6
  507.     move.w    d0,sp3+6
  508.     move.w    d0,sp4+6
  509.     move.w    d0,sp5+6
  510.     move.w    d0,sp6+6
  511.     move.w    d0,sp7+6
  512.     swap    d0
  513.     move.w    d0,sp0+2
  514.     move.w    d0,sp1+2
  515.     move.w    d0,sp2+2
  516.     move.w    d0,sp3+2
  517.     move.w    d0,sp4+2
  518.     move.w    d0,sp5+2
  519.     move.w    d0,sp6+2
  520.     move.w    d0,sp7+2
  521.     rts
  522. blnkspr:ds.l    4
  523.  
  524. txt1:    dc.b    0,0,13,255
  525.     dc.b    0,0,'    ****  commodore 64 basic v2 ****',13,255
  526.     dc.b    0,0,13,255
  527.     dc.b    0,0,' 64k ram system  38911 basic bytes free',13,255
  528.     dc.b    0,0,13,255
  529.     dc.b    0,0,'ready.',13,0
  530. rdytxt:    dc.b    0,0,13,255
  531.     dc.b    0,0,'ready.',13,0
  532. rdy2txt:dc.b    0,0,13,13,255
  533.     dc.b    0,0,'ready.',13,0
  534. rettxt:    dc.b    0,0,13,0
  535. syntxt:    dc.b    0,0,13,13,255
  536.     dc.b    0,0,'?syntax  error',13,255
  537. rdy3txt:dc.b    0,0,'ready.',13,0
  538. fretxt:    dc.b    0,0,'0 blocks free.',13,0
  539. dsktxt:    dc.b    0,0,128,'0    "'
  540. DISKNAM:DC.B    'pussy demo disk ",00,2d',13,0
  541. dirtxt1:dc.b    0,0,13,13,255
  542.     dc.b    0,0,'searching for $',13,0
  543. dirtxt2:dc.b    0,0,'loading',13,0
  544. dirtxt3:dc.b    0,0,'ready.',13,0
  545. helptxt:dc.b    0,0,'        ',128,'commodore 64 boot system',13,255
  546.     dc.b    0,0,'  ',128,'coded by mindeater of pussy 05/08/90',13,255
  547.     dc.b    0,0,'****************************************',13,13,255
  548.     dc.b    0,0,'instrucions:',13,13,255
  549.     dc.b    0,0,'load"$",8 <return>  (loads directory)',13,255
  550.     dc.b    0,0,13,255
  551.     dc.b    0,0,'list <return>  (lists entries)',13,255
  552.     dc.b    0,0,13,255
  553.     dc.b    0,0,'load"filename",8,1 <return> (loads demo)',13,13,255
  554.     dc.b    0,0,13,255
  555.     dc.b    0,0,'there are other commands find them',13,255
  556.     dc.b    0,0,'yourself.',13,255
  557.     dc.b    0,0,'enjoy this disk.',13,0
  558. fnftxt:    dc.b    0,0,'?file not found  error',13,255
  559.     dc.b    0,0,'ready.',13,0
  560. lodtxt:    dc.b    0,0,'loading',13,0
  561. starttxt:
  562.     dc.b    0,0,'             64 boot system',13,13,255
  563.     dc.b    0,0,'                   by',13,13,255
  564.     dc.b    0,0,'      ****** ****** ****** ******',13,255
  565.     dc.b    0,0,'      **     **  ** **     **  **',13,255
  566.     dc.b    0,0,'      ****** ****** ** *** ******',13,255
  567.     dc.b    0,0,'          ** **  ** **  ** **  **',13,255
  568.     dc.b    0,0,'      ****** **  ** ****** **  **',13,13,255
  569.     dc.b    0,0,'          coding by mindeater',13,13,13,255
  570.     dc.b    0,0,'members are:-',13,13,255
  571.     dc.b    0,0,'      mystik            mindeater',13,255
  572.     dc.b    0,0,'      wizoid             overkill',13,255
  573.     dc.b    0,0,'      xeno                 techno',13,255
  574.     dc.b    0,0,'      electro          electronic',13,255
  575.     dc.b    0,0,'      stryx                iceman',13,255
  576.     dc.b    0,0,'      the jedi               andy',13,13,13,255
  577.     dc.b    0,0,'    press left mouse button to start',0
  578.  
  579.     dc.b    '********  Write to me (Mindeater) ********'
  580.     dc.b    'A.Clark    2 Highfield Rise    Eastend Road    Hull    HU12 8RA    '
  581.     dc.b    '********      Thanks!!!     ********'
  582.     even
  583. screen:    incbin    'screeniff'
  584.     even
  585.  
  586. docurs:    tst.w    ccount
  587.     beq    .lp
  588.     sub.w    #1,ccount
  589.     rts
  590. .lp:    move.w    crate,ccount
  591.     bchg.b    #0,cstate+1
  592.     move.l    pln1,a0
  593.     moveq.l    #0,d0
  594.     move.b    xpos,d0
  595.     add.l    d0,a0
  596.     moveq.l    #0,d0
  597.     move.b    ypos,d0
  598.     mulu    #40*8,d0
  599.     add.l    d0,a0
  600.     eor.b    #-1,(a0)
  601.     eor.b    #-1,40(a0)
  602.     eor.b    #-1,80(a0)
  603.     eor.b    #-1,120(a0)
  604.     eor.b    #-1,160(a0)
  605.     eor.b    #-1,200(a0)
  606.     eor.b    #-1,240(a0)
  607.     eor.b    #-1,280(a0)
  608.     rts
  609.  
  610. loaddir:
  611.     move.l    dosbase,a6
  612.     move.l    #locknam,d1
  613.     move.l    #-2,d2
  614.     jsr    -84(a6)        ;lock
  615.     move.l    d0,lock
  616.  
  617.     move.l    dosbase,a6
  618.     move.l    lock,d1
  619.     move.l    #infodata,d2
  620.     jsr    -102(a6)    ;GET NAME OF DISK
  621.     
  622.     lea    infodata+8,a0
  623.     lea    disknam,a1
  624.     moveq.l    #15,d0
  625. .lp:    move.b    (a0)+,(a1)+
  626.     beq    .lp2
  627.     dbra    d0,.lp
  628.     bra    .lp4
  629.  
  630. .lp2:    sub.l    #1,a1
  631. .lp3    move.b    #32,(a1)+
  632.     dbra    d0,.lp3
  633.  
  634. .lp4:    
  635.     tst.l    getdir
  636.     bmi    .lq1
  637.  
  638.     lea    dirtxt2,a0
  639.     jsr    print
  640.  
  641. .lq1:    move.l    dosbase,a6
  642.     move.l    lock,d1
  643.     jsr    -90(a6)        ;unlock df0:
  644.     move.l    d0,lock
  645.  
  646.     move.l    dosbase,a6
  647.     move.l    #dirnam,d1
  648.     move.l    #-2,d2
  649.     jsr    -84(a6)        ;lock
  650.     move.l    d0,lock
  651.  
  652.     lea    dirlist,a0
  653.     move.l    #0,numdir
  654.  
  655.     move.l    a0,-(sp)
  656.  
  657. .lp8:    move.l    dosbase,a6
  658.     move.l    lock,d1
  659.     move.l    #infodata,d2
  660.     jsr    -108(a6)    ;examine next
  661.     tst.l    d0
  662.     beq    .lp5        ;no more
  663.  
  664.     move.l    #0,d2        ;num chars written
  665.     lea    infodata+124,a1    ;get length
  666.     move.l    (a1),d0
  667.     lsr.l    #8,d0
  668.     move.l    (sp)+,a0
  669.     move.l    a0,-(sp)
  670.     add.l    #2,a0
  671.  
  672.     move.l    #0,zero
  673.     move.l    d0,d1
  674.     divu    #1000,d0
  675.     tst.l    zero
  676.     bne    .zdun1
  677.     tst.w    d0
  678.     beq    .len1
  679. .zdun1:    add.b    #48,d0
  680.     move.b    d0,(a0)+
  681.     sub.b    #48,d0
  682.     mulu    #1000,d0
  683.     sub.l    d0,d1
  684.     add.l    #1,d2
  685.     move.l    #-1,zero
  686.  
  687. .len1:    move.l    d1,d0
  688.     divu    #100,d0
  689.     tst.l    zero
  690.     bne    .zdun2
  691.     tst.w    d0
  692.     beq    .len2
  693. .zdun2    add.b    #48,d0
  694.     move.b    d0,(a0)+
  695.     sub.b    #48,d0
  696.     mulu    #100,d0
  697.     sub.l    d0,d1
  698.     add.l    #1,d2
  699.  
  700. .len2:    move.l    d1,d0
  701.     divu    #10,d0
  702.     tst.l    zero
  703.     bne    .zdun3
  704.     tst.w    d0
  705.     beq    .len3
  706. .zdun3    add.b    #48,d0
  707.     move.b    d0,(a0)+
  708.     sub.b    #48,d0
  709.     mulu    #10,d0
  710.     sub.l    d0,d1
  711.     add.l    #1,d2
  712.  
  713. .len3:    move.l    d1,d0
  714.     tst.l    zero
  715.     bne    .zdun4
  716.     tst.w    d0
  717.     beq    .len4
  718. .zdun4    add.b    #48,d0
  719.     move.b    d0,(a0)+
  720.     add.l    #1,d2
  721.  
  722. .len4:    cmp.l    #4,d2
  723.     beq    .len5
  724.     move.b    #32,(a0)+
  725.     add.l    #1,d2
  726.     bra    .len4
  727.  
  728. .len5:    lea    infodata+8,a1
  729.     move.l    (sp)+,a0
  730.     move.l    a0,a2
  731.     add.l    #8,a0
  732.     moveq.l    #15,d0
  733. .lpa:    move.b    (a1)+,d7
  734.     beq    .notlo3
  735.     sub.b    #32,d7
  736.     btst.l    #6,d7
  737.     beq    .notlo2
  738.     sub.b    #32,d7
  739. .notlo2:add.b    #32,d7
  740. .notlo3:move.b    d7,(a0)+
  741.     beq    .lp6
  742.     dbra    d0,.lpa
  743.     bra    .lp7
  744.  
  745. .lp6:    sub.l    #1,a0
  746.     move.b    #34,(a0)+
  747. .lp9:    move.b    #32,(a0)+
  748.     dbra    d0,.lp9
  749. .lp7:    ;move.b    #34,(a0)+
  750.     add.l    #7,a0
  751.     move.b    #255,(a0)+
  752.  
  753.     ;jsr    print
  754.     add.l    #1,numdir
  755.     add.l    #33,a2
  756.     move.l    a2,-(sp)
  757.     bra    .lp8
  758.  
  759. .lp5:    move.l    (sp)+,a0
  760.     move.b    #0,-(a0)
  761.  
  762.     tst.l    getdir
  763.     bmi    .lq2    
  764.  
  765.     lea    dirtxt3,a0
  766.     jsr    print
  767. .lq2:    move.l    #0,getdir
  768.     rts
  769.  
  770. prntdir:lea    rettxt,a0
  771.     jsr    print
  772.  
  773.     lea    dsktxt,a0
  774.     jsr    print
  775.  
  776.     lea    dirlist,a0
  777.     jsr    print
  778.  
  779.     lea    fretxt,a0
  780.     jsr    print
  781.  
  782.     lea    rdytxt,a0
  783.     jsr    print
  784.     rts
  785.  
  786. retch:    tst.l    stringoff
  787.     beq    nocomm
  788.     lea    comline,a0    ;get commands
  789.     move.l    a0,a4    
  790.     lea    commaddr,a1
  791.     lea    commrout,a2
  792.     moveq.l    #0,d0        ;comm count * 4
  793.     moveq.l    #0,d2        ;comm count
  794. morcomm:move.l    (a1,d0),a3
  795.     move.l    a4,a0
  796.     moveq.l    #0,d1        ;index into string/comm
  797. .lp:    tst.b    (a3,d1)
  798.     beq    gotcomm
  799.     move.b    (a0,d1),d3
  800.     cmp.b    #32,d3        ;get rid of spaces
  801.     bne    .lp2
  802.     add.l    #1,a0
  803.     bra    .lp
  804. .lp2:    cmp.b    (a3,d1),d3
  805.     bne    notcomm
  806.     add.b    #1,d1
  807.     bra    .lp
  808. notcomm:add.l    #1,d2
  809.     add.l    #4,d0
  810.     cmp.l    #numcomm,d2
  811.     bne    morcomm
  812.     jsr    clrcurs
  813.     move.b    #0,xpos
  814.     lea    syntxt,a0
  815.     jsr    print
  816.     jsr    clrcomm
  817.     rts    
  818. nocomm:    jsr    clrcurs
  819.     lea    rettxt,a0
  820.     jsr    print
  821.     bra    clrcomm
  822. gotcomm:move.l    (a2,d0),a1
  823.     jmp    (a1)
  824.  
  825. numcomm    equ    9
  826.  
  827. commaddr:dc.l    comm1,comm2,comm3,comm4,comm5,comm6,comm7,comm8,comm9
  828. commrout:dc.l    dirload,list,bord,back,help,load,cls,cls,reset
  829.  
  830. comm1:    dc.b    'LOAD"$",8',0
  831. comm2:    dc.b    'LIST',0
  832. comm3:    dc.b    'POKE53280,',0
  833. comm4:    dc.b    'POKE53281,',0
  834. comm5:    dc.b    'HELP',0
  835. comm6:    dc.b    'LOAD"',0
  836. comm7:    dc.b    '?CHR$(147)',0
  837. comm8:    dc.b    'PRINTCHR$(147)',0
  838. comm9:    dc.b    'SYS64738',0
  839.     dc.b    '********  Write to me (Mindeater) ********'
  840.     dc.b    'A.Clark    2 Highfield Rise    Eastend Road    Hull    HU12 8RA    '
  841.     dc.b    '********      Thanks!!!     ********'
  842.  
  843.     even
  844.  
  845. dirload:
  846.     move.l    #1,loaded
  847.     jsr    clrcurs
  848.     jsr    clrcomm
  849.     move.b    #0,xpos    
  850.     lea    dirtxt1,a0
  851.     jsr    print
  852.     move.l    #1,getdir
  853.     rts
  854. list:
  855.     jsr    clrcurs
  856.     jsr    clrcomm
  857.     move.b    #0,xpos    
  858.     tst.l    loaded
  859.     beq    .lp
  860.     lea    rettxt,a0
  861.     jsr    print
  862.     jsr    prntdir
  863.     rts
  864. .lp:    lea    rdy2txt,a0
  865.     jsr    print
  866.     rts
  867. bord:
  868.     move.w    #0,d0
  869.     add.l    d1,a0
  870.     move.b    (a0)+,d0
  871.     tst.b    (a0)
  872.     beq    .1dig
  873.     lsl.l    #8,d0
  874.     move.b    (a0),d0
  875. .1dig:    move.l    #0,d1
  876.     lea    colwords,a0
  877. .lp:    cmp.w    (a0,d1),d0
  878.     beq    .gotcol
  879.     add.l    #2,d1
  880.     cmp.l    #32,d1
  881.     bne    .lp
  882.     jsr    clrcurs
  883.     move.b    #0,xpos    
  884.     jsr    clrcomm
  885.     lea    syntxt,a0
  886.     jsr    print
  887.     rts
  888. .gotcol:lea    realcols,a0
  889.     move.w    (a0,d1),bordcol+2
  890.     jsr    clrcurs
  891.     move.b    #0,xpos    
  892.     jsr    clrcomm
  893.     lea    rdy2txt,a0
  894.     jsr    print
  895.     rts
  896.  
  897. back:
  898.     move.w    #0,d0
  899.     add.l    d1,a0
  900.     move.b    (a0)+,d0
  901.     tst.b    (a0)
  902.     beq    .1dig
  903.     lsl.l    #8,d0
  904.     move.b    (a0),d0
  905. .1dig:    move.l    #0,d1
  906.     lea    colwords,a0
  907. .lp:    cmp.w    (a0,d1),d0
  908.     beq    .gotcol
  909.     add.l    #2,d1
  910.     cmp.l    #32,d1
  911.     bne    .lp
  912.     jsr    clrcurs
  913.     move.b    #0,xpos    
  914.     jsr    clrcomm
  915.     lea    syntxt,a0
  916.     jsr    print
  917.     rts
  918. .gotcol:lea    realcols,a0
  919.     move.w    (a0,d1),backcol+2
  920.     jsr    clrcurs
  921.     move.b    #0,xpos    
  922.     jsr    clrcomm
  923.     lea    rdy2txt,a0
  924.     jsr    print
  925.     rts
  926.  
  927. help:    
  928.     jsr    cls
  929.     lea    helptxt,a0
  930.     jsr    print
  931.     lea    rdytxt,a0
  932.     jsr    print
  933.     rts
  934. load:    
  935.     add.l    d1,a0
  936.     move.l    a0,-(sp)
  937.     jsr    clrcurs
  938.     move.b    #0,xpos    
  939.     tst.l    loaded
  940.     bne    .lp
  941.     move.l    #-1,getdir
  942.     jsr    loaddir
  943. .lp:    
  944.     move.l    (sp)+,a1
  945.  
  946.     lea    filename,a0
  947. .lp2:    move.b    (a1)+,(a0)+
  948.     beq    .lp3
  949.     cmp.b    #34,(a1)
  950.     bne    .lp2
  951.     move.b    #0,(a0)
  952.     add.l    #1,a1
  953.     cmp.b    #',',(a1)+
  954.     bne    .lp3
  955.     cmp.b    #'8',(a1)+
  956.     bne    .lp3
  957.     cmp.b    #',',(a1)+
  958.     beq    .lp8
  959.     sub.l    #1,a1
  960.     cmp.b    #0,(a1)+
  961.     beq    .lp9
  962. .lp8:    cmp.b    #'1',(a1)+
  963.     bne    .lp3
  964. .lp9:    lea    rettxt,a0
  965.     jsr    print
  966.     lea    seartxt,a0
  967.     jsr    print
  968.     lea    rettxt,a0
  969.     jsr    print
  970.     tst.l    numdir        ;any entries
  971.     beq    .lp4        ;none
  972.  
  973.     moveq.l    #0,d0        ;entrie number
  974.     moveq.l    #0,d1        ;index into names
  975.     lea    dirlist+8,a0
  976.     lea    filename,a1
  977. .lp5:    cmp.b    #42,(a1,d1)
  978.     beq    .gotentry
  979.     tst.b    (a1,d1)
  980.     beq    .gotentry
  981.     move.b    (a1,d1),d2
  982.     cmp.b    (a0,d1),d2
  983.     bne    .nope
  984.     tst.b    d2
  985.     beq    .gotentry
  986.     add.b    #1,d1
  987.     bra    .lp5
  988. .nope:    add.l    #33,a0
  989.     moveq.l    #0,d1
  990.     add.l    #1,d0
  991.     cmp.l    numdir,d0
  992.     bne    .lp5
  993.     lea    fnftxt,a0
  994.     jsr    print
  995.     jsr    clrcomm
  996.     rts
  997. .lp3:    jsr    clrcomm
  998.     lea    syntxt,a0
  999.     jsr    print
  1000.     rts
  1001. .lp4:    jsr    clrcomm
  1002.     lea    fnftxt,a0
  1003.     jsr    print
  1004.     rts
  1005. .gotentry:
  1006.     lea    realfile+3,a1
  1007. .lp6:    cmp.b    #34,(a0)
  1008.     beq    .lp7        ;ends with "
  1009.     move.b    (a0)+,(a1)+
  1010.     bra    .lp6
  1011. .lp7:    move.b    #0,(a1)
  1012.     lea    lodtxt,a0
  1013.     jsr    print
  1014.     jsr    clrcomm
  1015.     move.l    dosbase,a6
  1016.     move.l    #realfile,d1
  1017.     moveq.l    #0,d2
  1018.     moveq.l    #0,d3
  1019.     move.l    $6c,intsave
  1020.     jsr    -222(a6)
  1021.     move.l    intsave,$6c
  1022.     lea    rdy3txt,a0
  1023.     jsr    print
  1024.  
  1025.     lea    newcopper,a0
  1026.     lea    copycopper,a1
  1027. .cop:    move.l    (a1)+,(a0)+
  1028.     cmp.l    #$fffffffe,(a1)
  1029.     bne    .cop
  1030.     move.l    (a1)+,(a0)+
  1031.  
  1032.     move.l    plnbase,a1
  1033.     move.l    #plnsize,d0
  1034.     move.l    a1,stor
  1035.     move.l    stor,pln1
  1036.     move.w    stor,bp2+2
  1037.     move.w    stor+2,bp2+6
  1038.  
  1039.     add.l    d0,stor
  1040.     move.l    stor,pln2
  1041.     move.w    stor,bp1+2
  1042.     move.w    stor+2,bp1+6
  1043.  
  1044.     add.l    #40*24,pln1    
  1045.  
  1046.     jsr    killspr
  1047.     move.l    #newcopper,$dff080
  1048.     move.l    #newcopper,$dff084
  1049.     rts    
  1050.  
  1051. cls:    jsr    clrcurs
  1052.     jsr    clrcomm
  1053.     move.l    pln1,a0
  1054.     move.l    #1999,d0
  1055. .lp:    move.l    #0,(a0)+
  1056.     dbra    d0,.lp
  1057.     move.b    #0,xpos
  1058.     move.b    #0,ypos
  1059.     rts
  1060.  
  1061. reset:    jsr    cls
  1062.     lea    txt1,a0
  1063.     jsr    print
  1064.     rts
  1065.  
  1066.  
  1067. realcols:
  1068.     dc.w    $0000,$0fff,$0a33,$0cff,$0f9d,$07b7,$015b,$0ff8
  1069.     dc.w    $0fb8,$0962,$0f9a,$0666,$0aaa,$0cfc,$089f,$0ddd
  1070. colwords:
  1071.     dc.b    0,'0'
  1072.     dc.b    0,'1'
  1073.     dc.b    0,'2'
  1074.     dc.b    0,'3'
  1075.     dc.b    0,'4'
  1076.     dc.b    0,'5'
  1077.     dc.b    0,'6'
  1078.     dc.b    0,'7'
  1079.     dc.b    0,'8'
  1080.     dc.b    0,'9'
  1081.  
  1082.     dc.b    '10'
  1083.     dc.b    '11'
  1084.     dc.b    '12'
  1085.     dc.b    '13'
  1086.     dc.b    '14'
  1087.     dc.b    '15'
  1088.  
  1089. clrcomm:lea    string,a0
  1090.     move.l    #39,d0
  1091. .lp:    move.b    #0,(a0)+
  1092.     dbra    d0,.lp
  1093.     move.l    #0,stringoff
  1094.     rts
  1095. clrcurs:
  1096.     move.l    pln1,a0
  1097.     moveq.l    #0,d0
  1098.     move.b    xpos,d0
  1099.     add.l    d0,a0
  1100.     moveq.l    #0,d0
  1101.     move.b    ypos,d0
  1102.     mulu    #40*8,d0
  1103.     add.l    d0,a0
  1104.     move.b    #0,(a0)
  1105.     move.b    #0,40(a0)
  1106.     move.b    #0,80(a0)
  1107.     move.b    #0,120(a0)
  1108.     move.b    #0,160(a0)
  1109.     move.b    #0,200(a0)
  1110.     move.b    #0,240(a0)
  1111.     move.b    #0,280(a0)
  1112.  
  1113.     move.w    #0,ccount
  1114.     move.b    #0,cstate
  1115.     rts
  1116.  
  1117.  
  1118. locknam:dc.b    'df0:',0
  1119.     even
  1120. dirnam:dc.b    'df0:64/',0
  1121.     even
  1122.  
  1123. lock:    dc.l    0
  1124.     cnop    0,4
  1125. infodata:
  1126.     ds.b    300
  1127. numdir:    dc.l    0        ;number of entry's 33 bytes each
  1128. dirlist:rept    20
  1129.     dc.b    0,0,'0000 "                "   prg',13,0
  1130.     endr
  1131.     even
  1132. seartxt:dc.b    0,0,13,255,0,0,'searching for '
  1133. filename:
  1134.     ds.b    18
  1135. realfile:
  1136.     dc.b    '64/'
  1137.     ds.b    18
  1138.  
  1139.     even
  1140.  
  1141. copycopper:                    
  1142.     dc.w    $0100,$2200
  1143.     dc.w    $0102,$0000
  1144.  
  1145.     dc.w    $00e0,$0000,$00e2,$0000
  1146.     dc.w    $00e4,$0000,$00e6,$0000
  1147.     dc.w    $00e8,$0000,$00ea,$0000
  1148.     dc.w    $00ec,$0000,$00ee,$0000
  1149.     dc.w    $00f0,$0000,$00f2,$0000
  1150.  
  1151.     dc.w    $008E,$2c81,$0090,$2cc1                                 
  1152.     dc.w    $0092,$0038,$0094,$00d0
  1153.     dc.w    $0108,$0000,$010a,$0000
  1154.  
  1155.     dc.w    $0120,$0000,$0122,$0000    
  1156.     dc.w    $0124,$0000,$0126,$0000    
  1157.     dc.w    $0128,$0000,$012a,$0000    
  1158.     dc.w    $012c,$0000,$012e,$0000    
  1159.     dc.w    $0130,$0000,$0132,$0000    
  1160.     dc.w    $0134,$0000,$0136,$0000    
  1161.     dc.w    $0138,$0000,$013a,$0000    
  1162.     dc.w    $013c,$0000,$013e,$0000    
  1163.  
  1164.     dc.w    $0180,$089f
  1165.     dc.w    $0182,$015b
  1166.     dc.w    $0186,$089f
  1167.  
  1168.     dc.w    $ffff,$fffe
  1169.  
  1170.     dc.b    '********  Write to me (Mindeater) ********'
  1171.     dc.b    'A.Clark    2 Highfield Rise    Eastend Road    Hull    HU12 8RA    '
  1172.     dc.b    '********      Thanks!!!     ********'
  1173.  
  1174.